package com.city.service.party.impl;

import com.city.domain.party.PartyOrelationship;
import com.city.repository.party.PartyOrelationshipRepository;
import com.city.service.party.PartyOrelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PartyOrelationshipServiceImpl implements PartyOrelationshipService {


    @Autowired
    private PartyOrelationshipRepository partyOrelationshipRepository;


    @Override
    public List<PartyOrelationship> findByLimt(Integer page, Integer limit) {
        return partyOrelationshipRepository.findAllByPage((page-1)*limit, limit);
    }

    @Override
    public long count() {
        return partyOrelationshipRepository.count();
    }

    @Override
    public PartyOrelationship findById(int id) {
        return partyOrelationshipRepository.findOne(id);
    }

    @Override
    public void delete(int id) {
        partyOrelationshipRepository.delete(id);
    }
}
